package www.yfz.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import www.yfz.entity.User;
import www.yfz.service.UserService;

@WebServlet("/userList")
public class UserServlet extends HttpServlet {

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//调用service
		UserService userService = new UserService();
		List<User> userList = userService.getUserList();
		
		request.setAttribute("userList", userList); //将userList放到request作用域
		request.setAttribute("aaa", "我们");
		request.setAttribute("fff", "哈哈哈");
		request.setAttribute("dd", "老虎");
		request.setAttribute("xx", "林");
		
		request.getRequestDispatcher("userList.jsp").forward(request, response);
	}
}
